import { AppCategories } from "@prisma/client"; import { GetStaticPropsContext, InferGetStaticPropsType } from "next"; import Link from "next/link"; import { useRouter } from "next/router"; import { getAppRegistry } from "@calcom/app-store/_appRegistry"; import Shell from "@calcom/features/shell/Shell"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import prisma from "@calcom/prisma"; import { AppCard, SkeletonText } from "@calcom/ui"; export default function Apps({ apps }: InferGetStaticPropsType) { const { t, isLocaleReady } = useLocale(); const router = useRouter(); const { category } = router.query; return ( <> {isLocaleReady ? t("app_store") : }{" "} {category && (  /  {t("category_apps", { category: category[0].toUpperCase() + category?.slice(1) })} )} } large>
{apps.map((app) => { return ; })}
); } export const getStaticPaths = async () => { const paths = Object.keys(AppCategories); return { paths: paths.map((category) => ({ params: { category } })), fallback: false, }; }; export const getStaticProps = async (context: GetStaticPropsContext) => { const category = context.params?.category as AppCategories; const appQuery = await prisma.app.findMany({ where: { categories: { has: category, }, }, select: { slug: true, }, }); const dbAppsSlugs = appQuery.map((category) => category.slug); const appStore = await getAppRegistry(); const apps = appStore.filter((app) => dbAppsSlugs.includes(app.slug)); return { props: { apps, }, }; };